set -e
set -o pipefail
if [ -z "${LOCATION}" ]; then LOCATION=""; fi

for d in $DIRS; do p=$(dirname ${d}); s=${d/\/home\/$(whoami)\/work\/curves/\/mnt\/${LOCATION}\/capture}; mkdir -p ${d}_tune && if [ -d "${s}_tune" ]; then find ${s}_tune -type f -print0 | xargs -0 -I{} mv {} ${d}_tune/; fi && mkdir -p ${d} && if [ -d "${s}" ]; then find ${s} -type f -print0 | xargs -0 -I{} mv {} ${d}/; fi done
